<?php
/**
 * Created by PhpStorm.
 * User: 小灰灰
 * Date: 2023-10-18
 * Time: 14:14:31
 * Info: 清除缓存服务
 */

namespace plugin\huiblog\app\common;

use support\Cache;
use plugin\huiblog\app\model\NavGroup as NavGroupModel;

class CacheClear
{

    /**
     * 清除友情链接缓存
     * @return boolean
     */
    public static function clearBlogLinks()
    {
        Cache::delete('cacheBlogLinks');

        return true;
    }

    /**
     * 清除博文导航缓存
     *
     * @param $group_id
     */
    public static function clearBlogNavs($group_id)
    {
        $name = NavGroupModel::where('id', $group_id)->value('name');
        Cache::delete('blogNav'.$name);
    }

    /**
     * 清除博文总数量缓存
     */
    public static function clearArticleCount()
    {
        Cache::delete('blogArticleCount');
    }

    /**
     * 清除博客栏目分类总数缓存
     */
    public static function clearArticleCateCount()
    {
        Cache::delete('blogArticleCateCount');
    }

    /**
     * 清除博客关键词总数缓存
     */
    public static function clearKeywordsCount()
    {
        Cache::delete('blogKeywordsCount');
    }

}
